/*
    这里是uniFethcer的一个示例，说明了数据中间层如何运用dataFetcher来做数据处理
    实际使用的时候请复制这个js来写具体的数据处理代码
    注意：只允许在uniFetcher里面写，其余的代码为依赖，不得修改，否则代码会出错
*/
// import { coordConvetor } from "@/lib/coordConvetor";
import {
    URLHEAD,
    COORD_SYSTEM
} from '@/config/global'
import {
    fetchDataLocal,
    fetchDataGet,
    fetchDataPost
} from '@/request/datafetcher'
import {
    coordConvetor
} from "@/lib/coordConvetor";

const coordConvetorHash = {
    'gcj-02': (coord) => {
        return coordConvetor.GCJ02_ToWGS84(parseFloat(coord.split(',')[0]), parseFloat(coord.split(',')[1]))
    }
}

const covertCoord = coordConvetorHash[COORD_SYSTEM];
const ratio = JSON.parse(localStorage.ratio);
const RatioMap = {
    "1": "1x",
    "2": "2x"
}
let dirRatio = RatioMap[ratio];

Date.prototype.format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份 
        "d+": this.getDate(), //日 
        "h+": this.getHours(), //小时 
        "m+": this.getMinutes(), //分 
        "s+": this.getSeconds(), //秒 
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
        "S": this.getMilliseconds() //毫秒 
    };
    if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    }
    for (var k in o) {
        if (new RegExp("(" + k + ")").test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        }
    }
    return fmt;
}

export const uniFetcher = {
    getDemoData: async () => {
        /* 
        //输出数据示例放在这里，便于数据层按照输出示例return数据
        [{
            id:0,
            name:"demo",
            greetings:"helloWorld"
            coord:"0,0"
        }] 
        */
        let raw = await fetchDataLocal(`server/demo/test.json`);
        return raw.map(o => {
            return {
                id: o.id,
                name: o.name,
                greetings: o.greetings,
                coord: covertCoord(o.coord)
            }
        });
    },
    Ecological: {
        // 生态档案
        getArchivesInfo: async (params) => {
            console.log("getArchivesInfo", params);
            let pageSize = 100
            let pageNo = 1
            let raw = await fetchDataPost(`panel/ecology/getEcologicalFile/10/1`, params);
            console.log("getArchivesInfo", raw);
        },
        // 气象空气点位
        getFetchDataAirPOI: async () => {
            let num = "100"//条数
            let index = "0"//第几页
            let startDate = "2021-03-09"//开始日期
            let endDate = "2021-03-09"//结束日期
            let AirWeather = await fetchDataGet(`pointLocation/ecology/getPoiAirWeatherList/${num}/${index}/${startDate}/${endDate}`);//气象空气
            let AirOxygen = await fetchDataGet(`pointLocation/ecology/getPoiAirOxygenList/${num}/${index}/${startDate}/${endDate}`);//负氧离子
            let raw = [...AirWeather.data, ...AirOxygen.data]
            // let raw = [...AirWeather.data]
            console.log("getFetchDataAirPOI", raw);

            return raw.map(o => {
                let state = "normal"
                let info = ``
                if (o.name.indexOf("负氧离子") > -1) {
                    info = `negOxy=${o.detail.negOxy}&monitorTime=${o.detail.monitorTime}`
                } else {
                    console.log(111);
                    info = `NO2=${o.detail.no2}&CO=${o.detail.co}&SO2=${o.detail.so2}&O3=${o.detail.o3}&PM10=${o.detail.pm10}&PM2_5=${o.detail["pm2"]}&temperature=${o.detail.temperature}&humidity=${o.detail.humidity}&windSpeed=${o.detail.windSpeed}&windDirection=${o.detail.windDirection}&rainfall=${o.detail.rainfall}&atmoPress=${o.detail.atmoPress}&solaRadiation=${o.detail.solaRadiation}&noise=${o.detail.noise}&monitorTime=${o.detail.monitorTime}`
                }
                return {
                    id: o.id,
                    iconName: "ecology-air",
                    elevation: 1,
                    state: state,
                    // windowUrl: o.name.indexOf("负氧离子")>1 ? `${URLHEAD.attach}pages/${dirRatio}/ecology/noi-sensor-detail.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/air-sensor-detail.html?id=${o.id}`,
                    windowUrl: o.name.indexOf("负氧离子") > -1 ? `${URLHEAD.attach}pages/${dirRatio}/ecology/noi-sensor-detail.html?${info}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/air-sensor-detail.html?${info}`,
                    windowSize: o.name.indexOf("负氧离子") > 11 ? `800,120` : `1080,640`,
                    coord: o.location,
                    bindOn: "气象空气",
                    viewMode: "window",
                    viewName: null,
                }
            })
        },
        getAirPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/air.poi.json`);
            return raw.map(o => {
                let info = ``
                if (o.type === '负氧离子') {
                    info = `negOxy=${o.cargo.negOxy}&monitorTime=${o.cargo.monitorTime}`
                } else {
                    info = `NO2=${o.cargo.NO2}&CO=${o.cargo.CO}&SO2=${o.cargo.SO2}&O3=${o.cargo.O3}&PM10=${o.cargo.PM10}&PM2_5=${o.cargo["PM2.5"]}&temperature=${o.cargo.temperature}&humidity=${o.cargo.humidity}&windSpeed=${o.cargo.windSpeed}&windDirection=${o.cargo.windDirection}&rainfall=${o.cargo.rainfall}&atmoPress=${o.cargo.atmoPress}&solaRadiation=${o.cargo.solaRadiation}&noise=${o.cargo.noise}`
                }
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    // windowUrl: o.type === '负氧离子' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/noi-sensor-detail.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/air-sensor-detail.html?id=${o.id}&ratio=${ratio}`,
                    windowUrl: o.type === '负氧离子' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/noi-sensor-detail.html?${info}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/air-sensor-detail.html?${info}`,
                    // windowSize: o.type === '负氧离子' ? `800,120` : `1080,640`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getAirWarningPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/air.poi.json`);
            let result = []
            raw.forEach(o => {
                if (o.state === 'abnormal') {
                    result.push(o)
                }
            })
            return result.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: o.type === '负氧离子' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/noi-sensor-detail.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/air-sensor-detail.html?id=${o.id}`,
                    //windowSize: o.windowSize,
                    windowSize: "300,100",
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getAnimalPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/animal.poi.json`);
            return raw.map(o => {
                let info = ``
                if (o.type === '声纹') {
                    info = `species=${o.cargo.species}&monitorTime=${o.cargo.monitorTime}&audio=${o.cargo.audio}`
                } else {
                    info = `speciesName=${o.cargo.speciesName}&speciesMatching=${o.cargo.speciesMatching}&monitorTime=${o.cargo.monitorTime}&photoUrl=${o.cargo.photo}`
                }
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    title: o.title,
                    // windowUrl: o.type === '声纹' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-audio.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-photo-detail.html?id=${o.id}`,
                    windowUrl: o.type === '声纹' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-audio.html?${info}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-photo-detail.html?${info}`,
                    // windowSize: o.type === '声纹' ? "600,400" : "710,600",
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getAnimalWarningPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/animal.poi.json`);
            let result = []
            raw.forEach(o => {
                if (o.state === 'abnormal') {
                    result.push(o)
                }
            })
            return result.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    title: o.title,
                    windowUrl: o.type === '声纹' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-audio.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/animal-photo-detail.html?id=${o.id}`,
                    //windowSize: o.windowSize,
                    windowSize: "300,100",
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getWaterPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/water.poi.json`);
            return raw.map(o => {
                let info = `PH=${o.cargo.PH}&TP=${o.cargo.TP}&temperature=${o.cargo.temperature}&TN=${o.cargo.TN}&DO=${o.cargo.DO}&CODMn=${o.cargo.CODMn}&conductivity=${o.cargo.conductivity}&NTU=${o.cargo.NTU}&NHN=${o.cargo["NH-N"]}&chala=${o.cargo.chala}&waterlevel=${o.cargo.waterlevel}&monitorTime=${o.cargo.monitorTime}`
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/water-detail.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        // 水点位
        getFetchDataWaterPOI: async () => {
            let num = "100"//条数
            let index = "0"//第几页
            let startDate = "2021-03-09"//开始日期
            let endDate = "2021-03-09"//结束日期
            let raw = await fetchDataGet(`pointLocation/ecology/getPoiWaterList/${num}/${index}/${startDate}/${endDate}`);
            return raw.data.map(o => {
                let state = "normal"
                // console.log("o.detail.temperature", parseInt(o.detail.temperature), o);
                // if (parseInt(o.detail.temperature) > 21) {
                //     state = "abnormal"
                // }
                let info = `PH=${o.detail.ph}&TP=${o.detail.tp}&temperature=${o.detail.temperature}&TN=${o.detail.tn}&DO=${o.detail.do}&CODMn=${o.detail.codMn}&conductivity=${o.detail.conductivity}&NTU=${o.detail.ntu}&NHN=${o.detail.nhn}&chala=${o.detail.chala}&waterlevel=${o.detail.waterLevel}&monitorTime=${o.detail.monitorTime}`
                return {
                    id: o.id,
                    iconName: "ecology-water",
                    elevation: 1,
                    state: state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/water-detail.html?${info}`,
                    windowSize: "1080,558",
                    coord: o.location,
                    bindOn: "水",
                    viewMode: "window",
                    viewName: null,
                }
            })
        },
        getWaterWarningPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/water.poi.json`);
            let result = []
            raw.forEach(o => {
                if (o.state === 'abnormal') {
                    result.push(o)
                }
            })
            return result.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/water-detail.html?id=${o.id}`,
                    //windowSize: o.windowSize,
                    windowSize: "300,100",
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getSoilPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/soil.poi.json`);
            return raw.map(o => {
                let info = `temperature=${o.cargo.temperature}&humidity=${o.cargo.humidity}&conductivity=${o.cargo.conductivity}&PH=${o.cargo.PH}&thermalCond=${o.cargo.thermalCond}&monitorTime=${o.cargo.monitorTime}`
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    // windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/earth-detail.html?id=${o.id}&ratio=${ratio}`,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/earth-detail.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        // 土点位
        getFetchDataSoilPOI: async () => {
            let num = "100"//条数
            let index = "0"//第几页
            let startDate = "2021-03-09"//开始日期
            let endDate = "2021-03-09"//结束日期
            let raw = await fetchDataGet(`pointLocation/ecology/getPoiWaterList/${num}/${index}/${startDate}/${endDate}`);
            return raw.data.map(o => {
                let state = "normal"
                console.log("o.detail.temperature", o.detail.temperature, o);
                if (parseInt(o.detail.temperature) > 25) {
                    state = "abnormal"
                }
                return {
                    id: o.id,
                    iconName: "ecology-water",
                    elevation: 1,
                    state: state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/water-detail.html?id=${o.id}`,
                    windowSize: "300,100",
                    coord: o.location,
                    bindOn: "水",
                    viewMode: "window",
                    viewName: null,
                }
            })
        },
        getSoilWarningPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/soil.poi.json`);
            let result = []
            raw.forEach(o => {
                if (o.state === 'abnormal') {
                    result.push(o)
                }
            })
            return result.map(o => {
                if (o.state === 'abnormal') {
                    return {
                        id: o.id,
                        iconName: o.iconName,
                        elevation: 1,
                        state: o.state,
                        windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/earth-detail.html?id=${o.id}`,
                        //windowSize: o.windowSize,
                        windowSize: "300,100",
                        coord: o.coord,
                        bindOn: o.bindOn,
                        viewMode: o.viewMode,
                        viewName: o.viewName,
                    }
                }
            })
        },
        getPlantPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/plant.poi.json`);
            return raw.map(o => {
                let info = ""
                if (o.type === "物候") {
                    info = `NDVI=${o.cargo.NDVI}&EVI=${o.cargo.EVI}&monitorTime=${o.cargo.monitorTime}`
                } else {
                    info = `DBH=${o.cargo.DBH}&perimeter=${o.cargo.perimeter}&monitorTime=${o.cargo.monitorTime}`
                }
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    // windowUrl: o.type === '物候' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-photo-detail.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-sensor-detail.html?id=${o.id}`,
                    windowUrl: o.type === '物候' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-photo-detail.html?${info}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-sensor-detail.html?${info}`,
                    // windowSize: o.type === '物候' ? `720,600` : `540,270`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getPlantWarningPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/plant.poi.json`);
            let result = []
            raw.forEach(o => {
                if (o.state === 'abnormal') {
                    result.push(o)
                }
            })
            return result.map(o => {
                if (o.state === 'abnormal') {
                    return {
                        id: o.id,
                        iconName: o.iconName,
                        elevation: 1,
                        state: o.state,
                        windowUrl: o.type === '物候' ? `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-photo-detail.html?id=${o.id}` : `${URLHEAD.attach}pages/${dirRatio}/ecology/plant-sensor-detail.html?id=${o.id}`,
                        //windowSize: o.windowSize,
                        windowSize: "300,100",
                        coord: o.coord,
                        bindOn: o.bindOn,
                        viewMode: o.viewMode,
                        viewName: o.viewName,
                    }
                }
            })
        },
        // 养护
        getMaintainPOI: async () => {
            let raw = await fetchDataLocal(`data/ecological/maintain.poi.json`);
            return raw.map(o => {
                let info = `currentStatus=${o.cargo.currentStatus}&abnormal=${o.cargo.abnormal}&coord=${o.coord}&id=${o.id}`
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/ecology/maintain-detail.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getEcologyPanelData: async () => {
            let raw = await fetchDataGet('panel/ecology/getEcologyPanel');
            return raw.data
        }
    },
    Construction: {
        getCameraPOI: async () => {
            let raw = await fetchDataLocal('data/construct/videoSurveillance.poi.json')
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/construction/camera.html?title=${o.cargo.title}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getRoamPOI: async () => {
            let raw = await fetchDataLocal('data/construct/roam.poi.json')
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl:o.windowUrl,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },

        // 智慧建造首屏窗口点位数据接收
        getDefaultPOI: async () => {
            let raw = await fetchDataLocal('data/construct/firstScreen.poi.json')

            return raw.map(o => {

                let info = `projectPhase=${o.cargo.projectPhase}&bulidArea=${o.cargo.bulidArea}&investmentAmount=${o.cargo.investmentAmount}&plantPeople=${o.cargo.plantPeople}&hiddenDanger=${o.cargo.hiddenDanger}&projectSchedule=${o.cargo.projectSchedule}&landUsepArea=${o.cargo.landUsepArea}&greeningRate=${o.cargo.greeningRate}&height=${o.cargo.height}`

                return {
                    id: o.id,
                    iconName: o.iconName,
                    labelName: o.labelName,
                    elevation: 1,
                    state: o.state,
                    title: o.title,
                    windowUrl: `${URLHEAD.attach}pages/${dirRatio}/construction/${o.windowUrl}.html?${info}`,
                    windowSize: `${+(o.windowSize.split(',')[0]) * ratio},${+(o.windowSize.split(',')[1]) * ratio}`,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        // 智慧建造 项目概况
        getBuildProject: async () => {
            let raw = await fetchDataGet(`panel/build/getBuildProject`)
            return raw.data
        },
    },
    Landscape: {
        getBoradcastPOI: async () => {
            let raw = await fetchDataLocal(`data/landscape/broadcast.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/landscape/radio-broadcast.html?currentState=${o.cargo.currentState}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getBusPOI: async () => {
            let raw = await fetchDataLocal(`data/landscape/bus.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: o.windowUrl,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getBusStationPOI: async () => {
            let raw = await fetchDataLocal(`data/landscape/busStation.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/landscape/busStop.html?waitingNumber=${o.cargo.waitingNumber}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getCameraPOI: async () => {
            let raw = await fetchDataLocal(`data/landscape/camera.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/landscape/camera.html?waitingNumber=${o.cargo.videoUrl}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getRestroomPOI: async () => {
            let raw = await fetchDataLocal(`data/landscape/restroom.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/landscape/posts.html?waitingNumber=${o.cargo.waitingNumber}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        // 智慧风景游客预约
        getBookingPeople: async () => {
            let now = "2021-03-09"
            // let now = new Date().format("yyyy-MM-dd");
            let raw = await fetchDataGet(`panel/scenery/getSceneryAppoint/${now}`)
            return raw.data
        },
        // 智慧风景游客人流
        getStreamPeople: async () => {
            let now = "2021-03-09"
            // let now = new Date().format("yyyy-MM-dd");
            let raw = await fetchDataGet(`panel/scenery/getSceneryVisitorMonitor/${now}/${now}`)
            return raw.data
        },
        // 智慧风景游客信息
        getPeopleInfo: async () => {
            let now = "2021-03-09"
            // let now = new Date().format("yyyy-MM-dd");
            let raw = await fetchDataGet(`panel/scenery/getSceneryVisitorInfo/${now}/${now}`)
            return raw.data
        }
    },
    Management: {
        getCameraPOI: async () => {
            let raw = await fetchDataLocal(`data/management/camera.poi.json`)
            return raw.map(o => {
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/smartManagement/camera.html?`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        getWorkerPOI: async () => {
            let raw = await fetchDataLocal(`data/management/personnel.poi.json`)
            return raw.map(o => {
                let info = `name=${o.cargo.name}&contactInformation=${o.cargo.contactInformation}&posts=${o.cargo.posts}&department=${o.cargo.department}&groupLeader=${o.cargo.groupLeader}&alarmTime=${o.cargo.alarmTime}&alarmType=${o.cargo.alarmType}&alarmLevel=${o.cargo.alarmLevel}&disposalStatus=${o.cargo.disposalStatus}&state=${o.state}`
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/smartManagement/personnel.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },

        getFacilityPOI: async () => {
            let raw = await fetchDataLocal(`data/management/facility.poi.json`)
            return raw.map(o => {
                let info = ``
                if (o.state === "normal") {
                    info = `equipmentName=${o.cargo.equipmentName}&state=${o.state}`
                }
                else {
                    info = `equipmentName=${o.cargo.equipmentName}&alarmTime=${o.cargo.alarmTime}&alarmType=${o.cargo.alarmType}&alarmLevel=${o.cargo.alarmLevel}&state=${o.state}`
                }
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/smartManagement/facility.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },

        getVehiclePOI: async () => {
            let raw = await fetchDataLocal(`data/management/vehicle.poi.json`)
            return raw.map(o => {
                let info = ``
                if (o.state === "normal") {
                    info = `vehicleNumber=${o.cargo.vehicleNumber}&vehicleType=${o.cargo.vehicleType}&state=${o.state}`
                }
                else {
                    info = `vehicleNumber=${o.cargo.vehicleNumber}&vehicleType=${o.cargo.vehicleType}&alarmLevel=${o.cargo.alarmLevel}&alarmType=${o.cargo.alarmType}&state=${o.state}`
                }
                return {
                    id: o.id,
                    iconName: o.iconName,
                    elevation: 1,
                    state: o.state,
                    windowUrl: `${URLHEAD.attach}pages/smartManagement/vehicle.html?${info}`,
                    windowSize: o.windowSize,
                    coord: o.coord,
                    bindOn: o.bindOn,
                    viewMode: o.viewMode,
                    viewName: o.viewName,
                }
            })
        },
        // 智慧管理重点区域监控
        getImportantCameraGroup: async (num) => {
            let raw = await fetchDataGet(`panel/manage/getManageArea/${num}`)
            return raw.data.group1.map(o => {
                return {
                    url: o.url[0],
                    title: o.title
                }
            })
        },
        //智慧管理今日报警检测
        getTodayWarningList: async () => {
            let raw = await fetchDataGet('panel/manage/getPanelAlarmNumToday')
            return raw.data
        },
        //智慧管理人员车辆设备
        getPanelManageCarAndPeople: async () => {
            let raw = await fetchDataGet('panel/manage/getPanelManageCarAndPeople')
            return raw.data
        },
        //智慧管理今日未处理任务
        getManageNoDispose: async () => {
            let now = "2021-03-09"
            let raw = await fetchDataGet(`panel/manage/getManageNoDispose/${now}/${now}`)
            return raw.data
        }
    },

}

export const uniFetcherEcological = uniFetcher.Ecological;
export const uniFetcherConstruction = uniFetcher.Construction
export const uniFetcherLandscape = uniFetcher.Landscape
export const uniFetcherManagement = uniFetcher.Management